<template>
    <div >
         <section id="projects" class="projects-section">
            <ul>
                <li>
                    <p>1. 创建Token</p>
                    <pre>

    import { ChainId, Token } from '@uniswap/sdk'

    const token = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'DAI', 'DaiCoin')
                    </pre>
                </li>
                <li>
                    <p>2. 创建交易对</p>
                    <pre>
import { ChainId, Token, TokenAmount, Pair } from '@uniswap/sdk'

const ETH = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'ETH', 'Etherem')

const DAI = new Token(ChainId.MAINNET, '0xDeCAf00000000000000000000000000000000000', 18, 'DAI', 'DaiCoin')

const pair = new Pair(new TokenAmount(ETH, '2000000000000000000'), new TokenAmount(DAI, '1000000000000000000'))
                    </pre>
                </li>
                <li>
                    <p>3. 创建交易对路由</p>
                    <pre>
import { ChainId, Token, TokenAmount, Pair, Route } from '@uniswap/sdk'

const HOT = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'HOT', 'Caffeine')
const NOT = new Token(ChainId.MAINNET, '0xDeCAf00000000000000000000000000000000000', 18, 'NOT', 'Caffeine')
const HOT_NOT = new Pair(new TokenAmount(HOT, '2000000000000000000'), new TokenAmount(NOT, '1000000000000000000'))

const route = new Route([HOT_NOT], NOT)
                    </pre>
                </li>
                <li>
                    <p>4. 创建交易类型</p>
                    <pre>
import { ChainId, Token, TokenAmount, Pair, TradeType, Route } from '@uniswap/sdk'

const HOT = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'HOT', 'Caffeine')
const NOT = new Token(ChainId.MAINNET, '0xDeCAf00000000000000000000000000000000000', 18, 'NOT', 'Caffeine')
const HOT_NOT = new Pair(new TokenAmount(HOT, '2000000000000000000'), new TokenAmount(NOT, '1000000000000000000'))
const NOT_TO_HOT = new Route([HOT_NOT], NOT)

const trade = new Trade(NOT_TO_HOT, new TokenAmount(NOT, '1000000000000000'), TradeType.EXACT_INPUT)
                    </pre>
                </li>
                <li>
                    <p>5. 百分比、账号、价格</p>
                    <pre>
                        // 百分比
                        import { Percent } from '@uniswap/sdk'

                        const percent = new Percent('60', '100')
                        console.log(percent.toSignificant(2)) // 60 

                        // 账号
                        import { Token, TokenAmount } from '@uniswap/sdk'

                        const FRIED = new Token(ChainId.MAINNET, '0xfa1aFe1000000000000000000000000000000000', 18, 'FRIED', 'Beans')

                        const tokenAmount = new TokenAmount(FRIED, '3000000000000000000')
                        console.log(tokenAmount.toExact()) // 3

                        // 价格
                        import { ChainId, WETH as WETHs, Token, Price } from '@uniswap/sdk'

                        const WETH = WETHs[ChainId.MAINNET]
                        const ABC = new Token(ChainId.MAINNET, '0xabc0000000000000000000000000000000000000', 18, 'ABC')

                        const price = new Price(WETH, ABC, '1000000000000000000', '123000000000000000000')
                        console.log(price.toSignificant(3)) // 123
                    </pre>
                </li>
            </ul>
        </section>
        
    </div>
</template>
<style scoped>
.projects-section {
    margin-top: 2rem;
 
    padding: 5rem 2rem;
    color: black;
    background: #f0f1f3;
}

p {
    display: inline-block;
    margin: 10px;
}

pre {
    color: whitesmoke;
    background: #45567d;
}

</style>
<script>
import { ChainId, Token, Pair, TokenAmount, Route, Trade, TradeType, Percent, WETH as WETHs, Price} from '@uniswap/sdk'

const token = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'HOT', 'Caffeine')
console.log(token, "1. 创建token")


const ETH = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'ETH', 'Etherem')

const DAI = new Token(ChainId.MAINNET, '0xDeCAf00000000000000000000000000000000000', 18, 'DAI', 'DaiCoin')

const pair = new Pair(new TokenAmount(ETH, '2000000000000000000'), new TokenAmount(DAI, '1000000000000000000'))
  
console.log(pair, "2. 创建交易对")


const HOT = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'HOT', 'Caffeine')
const NOT = new Token(ChainId.MAINNET, '0xDeCAf00000000000000000000000000000000000', 18, 'NOT', 'Caffeine')
const HOT_NOT = new Pair(new TokenAmount(HOT, '2000000000000000000'), new TokenAmount(NOT, '1000000000000000000'))

const route = new Route([HOT_NOT], NOT)

console.log(route, "3. 创建交易对路由")

 
const HOT2 = new Token(ChainId.MAINNET, '0xc0FFee0000000000000000000000000000000000', 18, 'HOT2', 'Caffeine')
const NOT2 = new Token(ChainId.MAINNET, '0xDeCAf00000000000000000000000000000000000', 18, 'NOT2', 'Caffeine')
const HOT2_NOT2 = new Pair(new TokenAmount(HOT2, '2000000000000000000'), new TokenAmount(NOT2, '1000000000000000000'))
const NOT2_TO_HOT2 = new Route([HOT2_NOT2], NOT2)

const trade = new Trade(NOT2_TO_HOT2, new TokenAmount(NOT2, '1000000000000000'), TradeType.EXACT_INPUT)

console.log(trade, "4. 创建交易类型")


// 百分比
const percent = new Percent('60', '100')


// 账号
const FRIED = new Token(ChainId.MAINNET, '0xfa1aFe1000000000000000000000000000000000', 18, 'FRIED', 'Beans')

const tokenAmount = new TokenAmount(FRIED, '3000000000000000000')


// 价格

const WETH = WETHs[ChainId.MAINNET]
const ABC = new Token(ChainId.MAINNET, '0xabc0000000000000000000000000000000000000', 18, 'ABC')

const price = new Price(WETH, ABC, '1000000000000000000', '123000000000000000000')
 
console.log(percent.toSignificant(2),tokenAmount.toExact(),price.toSignificant(3), "5.百分比、账号、价格 " )  
 

export default {
    name: 'UniswapDemo',
    components: {}
}
</script>